/**
* 版权声明：厦门睿商网络科技有限公司 版权所有 违者必究
* 日    期：2020-12-15
*/
package com.rzico.article.service;

import com.rzico.article.model.TalentVo;
import com.rzico.base.BaseMapper;
import com.rzico.base.impl.BaseServiceImpl;
import com.rzico.article.entity.Talent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rzico.article.mapper.TalentMapper;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <pre>
 * 达人档案业务类
 * </pre>
 *
 * @author Rzico Boot
 * @version 1.0
 */
@Service
public class TalentService extends BaseServiceImpl<Talent, String> {

    @Autowired
    private TalentMapper talentMapper;

    @Override
    public BaseMapper<Talent, String> getMapper() {
        return talentMapper;
    }


    public Talent findByMember(Long memberId) {
        Map<String,Object> params = new HashMap<>();
        params.put("memberId",memberId);
        List<Talent> telentList= talentMapper.selectList(params);
        if (telentList.size()>0) {
            return telentList.get(0);
        } else {
            return null;
        }
    }

    /**
     * 添加关注人数
     * @param params
     * @return
     */
    public Integer addFollow(Map<String, Object> params){
        return talentMapper.addFollow(params);
    }

    /**
     * 删除关注人数
     * @param params
     * @return
     */
    public Integer decFollow(Map<String, Object> params){
        return talentMapper.decFollow(params);
    }

    /**
     * 添加粉丝人数
     * @param params
     * @return
     */
    public Integer addLove(Map<String, Object> params){
        return talentMapper.addLove(params);
    }

    /**
     * 删除粉丝人数
     * @param params
     * @return
     */
    public Integer decLvoe(Map<String, Object> params){
        return talentMapper.decLvoe(params);
    }

    public TalentVo findTalentVoByTalentId(Long talentId) {
        return talentMapper.findTalentVoByTalentId(talentId);
    }
}
